class Demo:
    __instance=None # __开头表示私有属性
    def __new__(cls, *args, **kwargs):
        if cls.__instance is None:
            instance=super().__new__(cls)
            cls.__instance=instance
        return cls.__instance

if __name__ == '__main__':
    d1=Demo()
    # Demo._Demo__instance=None 双下滑线的私有属性在存储是被改名为：_类名__属性名
    print(d1)
    d2=Demo()
    print(d2)
    print(Demo.__dict__)